<?php

class AjaxcallModule extends fvModule {

    function __construct () {
        $moduleName = strtolower(substr(__CLASS__, 0, -6));

        parent::__construct(fvSite::$fvConfig->get("modules.{$moduleName}.smarty.template"), 
                            fvSite::$fvConfig->get("modules.{$moduleName}.smarty.compile"), 
                            fvSite::$Layoult);
    }

    function showShowcountries() {
        if (strlen($countryList = fvRequest::getInstance()->getRequestParameter("countryList")) > 0) {
            $countryList = explode(',', $countryList);
        } else {
            $countryList = array();
        }
        
        $Countries = CountryManager::getInstance()->getAll(null, 'name');
        
        $this->__assign(array(
            'selectedCountries' => $countryList,
            'Countries'    => $Countries,
        ));
        
        return $this->__display('countries.tpl');
    }
    
    function showShowsubrubric() {
        $request = fvRequest::getInstance();
        
        $message = Null;  
        if (!$request->getRequestParameter("rubric_id")){
            $message = "Необходимо выбрать рубрику."; 
        }else{
            $sub_rubrics = RubricManager::getInstance()->getAll('parentId='.$request->getRequestParameter("rubric_id"));
            if(!count($sub_rubrics)){
               $message = "В этой рубрике нет подрубрик.";                     
            }
        }
        
        $this->__assign(array(
            'sub_rubrics'    => $sub_rubrics,
            'message'	=> $message,
        ));
        
        return $this->__display('show_sub_rubric.tpl');
    }
}

?>
